import request from '@/utils/request'

// 查询入库记录列表
export function getWarehousinginfo(courseId,flow){
  return request({
    url: '/course/course/getWarehousinginfo',
    method: 'get',
    params:{
      courseId:courseId,
      flow:flow
    }
  })
}

// 查询检测记录列表
export function getDetection(courseId,status){
  return request({
    url: '/course/course/getDetection',
    method: 'get',
    params:{
      courseId:courseId,
      status:status
    }
  })
}

// 查询操作流程列表
export function getControls(courseId,flow){
  return request({
    url: '/course/course/getControls',
    method: 'get',
    params:{
      courseId:courseId,
      flow:flow
    }
  })
}

// 查询生产过程管理列表
export function listCourse(query) {
  return request({
    url: '/course/course/list',
    method: 'get',
    params: query
  })
}

// 查询生产过程管理详细
export function getCourse(id) {
  return request({
    url: '/course/course/' + id,
    method: 'get'
  })
}

// 新增生产过程管理
export function addCourse(data) {
  return request({
    url: '/course/course',
    method: 'post',
    data: data
  })
}

export function addControls(data) {
  return request({
    url: '/course/course/controls',
    method: 'post',
    data: data
  })
}

export function addDetection(data) {
  return request({
    url: '/course/course/detection',
    method: 'post',
    data: data
  })
}

// 修改生产过程管理
export function updateCourse(data) {
  return request({
    url: '/course/course',
    method: 'put',
    data: data
  })
}

// 删除生产过程管理
export function delCourse(id) {
  return request({
    url: '/course/course/' + id,
    method: 'delete'
  })
}
export function delDialogue(id) {
  return request({
    url: '/course/course/delDialogue/' + id,
    method: 'delete'
  })
}

export async function getIsInStock(id) {
  return request({
    url: '/course/course/getIsInStock/' + id,
    method: 'post',
    data: {
      id: id
    }
  });
}

